<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>    
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>API_MANAGER</title>
    
</head>

<body>
<jsp:include page="/common/head.jsp"></jsp:include>
<div style="background:#edecec;">
	<table id="managerList"></table>
	<div id="toolbar">
		状态：
		<select name="apis.isok" id="status" style="width:120px;">
			<option value="">所有</option>
			<option value="ok" <c:if test="${status=='ok'}">selected="selected"</c:if>>接口文档撰写完成</option>
			<option value="no" <c:if test="${status=='no'}">selected="selected"</c:if>>接口文档撰写没完成</option>
			<option value="dev" <c:if test="${status=='dev'}">selected="selected"</c:if>>接口开发阶段</option>
			<option value="over" <c:if test="${status=='over'}">selected="selected"</c:if>>接口开发完成</option>
			<option value="testno" <c:if test="${status=='testno'}">selected="selected"</c:if>>接口开发完成没有自测</option>
			<option value="testok" <c:if test="${status=='testok'}">selected="selected"</c:if>>接口开发完成已经自测完成</option>
		</select>
		接口修改日期：	
		<input name="startDate" type="text" id="startdate" class="Wdate" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="${startDate}">
		~<input name="endDate" type="text" id="enddate" class="Wdate" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="${endDate}">	
		接口撰写人：
			<input type="text" id="aname" name="aUserName" style="width:100px;height:22px">
		接口开发人：
			<input type="text" id="dname" name="dUserName" style="width:100px;height:22px">
		<a href="javascript:void(0)" id="search" class="easyui-linkbutton">查询</a>
		<input type="hidden" style="width:150px" id="aid" value="${aid }" />
		<a href="javascript:void(0)" id="go1" class="easyui-linkbutton">返回</a>
	</div>
</div>

<script type="text/javascript">
$(document).ready(function(){
	$("#managerList").datagrid({
		url:"<%=path%>/projAction!apiList?aid="+$("#aid").val(),
		columns:[[ 
			{field:'id',title:'接口编号',width:0,hidden:true},
			{field:'projname',title:'项目名称',width:80},
			{field:'catename',title:'接口模块名称',width:80},
			{field:'cname',title:'接口名称',width:100,formatter:function(value,rowData,rowIndex){
				var aTag = "<a href=\"<%=path%>/apiAction!gotoapieditandinfo?api.id=";
				
				aTag += rowData.id+"\">"+value+"</a>";
                return aTag;  
           	}} ,
			/* {field:'type',title:'请求类型',width:80},
			{field:'url',title:'请求地址',width:220}, */
			{field:'cdesc',title:'接口描述',width:200},
			/* {field:'callbak',title:'返回参数备注',width:200}, */
			/* {field:'isdel',title:'是否删除',width:70,formatter:function(value){
				if('0'==value){
					return '否';
				}else{
					return '是';
				}				
			}}, */
			{field:'isok',title:'接口状态',width:150,formatter:function(value){
				var rs = '';
				if(value=='ok'){
					rs = '接口文档撰写完成';
				}else if(value=='no'){
					rs = '接口文档撰写没完成';
				}else if(value=='dev'){
					rs = '接口开发阶段';
				}else if(value=='over'){
					rs = '接口开发完成';
				}else if(value=='testno'){
					rs = '接口开发完成没有自测';
				}else if(value=='testok'){
					rs = '接口开发完成已经自测完成';
				}
				return rs;
			}},
			{field:'apiusername',title:'接口撰写人',width:80},
			{field:'devusername',title:'接口开发人',width:80},
			{field:'updatetime',title:'时间',width:100,formatter:function(value){
				if(null!=value&&""!=value){
					return formatDate(value);
				}				
			}},
			
		]],
		toolbar:'#toolbar',  //表格菜单
		loadMsg:'数据加载中请稍后……', //加载提示
		pagination:true, //显示分页工具栏
		rownumbers:true, //显示行号列
		//singleSelect:false,//是允许选择一行
		//queryParams:{   
			//在请求数据是发送的额外参数，如果没有则不用谢
		//	'cate.pid':$("#pid").val()
		//},
		height:'350px',
		onLoadSuccess:function(){
			
		}
	});
	$("#go1").click(function(){
		window.location.href="<%=path%>/projAction!gotolist";
	});

	$("#search").click(function(){
		
		var url_new = "<%=path%>/projAction!apiList?aid="+$("#aid").val()+"&status="
				+$("#status").val()+"&startDate="+$("[name='startDate']").val()+
				"&endDate="+$("[name='endDate']").val()+"&aname="+$("#aname").val()+"&dname="+$("#dname").val();
		$('#managerList').datagrid('options').url=url_new;  
		$("#managerList").datagrid('reload'); 
	});
});
</script>
</body>
</html>